package com.example;

import java.util.HashMap;

/**
 * 加载顺序Demo
 * 静态代码块》代码块》构造方法
 * @Author: wyp
 * @Date: 2021/11/30 14:39
 */
public class LoadDemo {
    static{
        System.out.println("LoadDemo静态代码块");
    }
    {
        System.out.println("LoadDemo代码块");
    }

    public LoadDemo() {
        System.out.println("LoadDemo构造方法");
    }

    public static void main(String[] args) {
        System.out.println("进入LoadDemo-Main方法");
        System.out.println("-------------------");
        new LoadDemo();
        System.out.println("-------------------");
        new TestDemo();
    }
}

class TestDemo{
    static{
        System.out.println("TestDemo静态代码块");
    }
    {
        System.out.println("TestDemo代码块");
    }

    public TestDemo() {
        System.out.println("TestDemo构造方法");
    }
}
